package org.demo2.springmvc_demo3.dto;

public class UserDTO {
    private String username;
    private String password;
    private String email;

    // 构造函数
    public UserDTO() {
    }

    public UserDTO(String username, String password, String email) {
        this.username = username;
        this.password = password;
        this.email = email;
    }

    // Getter 方法
    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public String getEmail() {
        return email;
    }

    // Setter 方法
    public void setUsername(String username) {
        this.username = username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    // equals 方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UserDTO userDTO = (UserDTO) o;
        return java.util.Objects.equals(username, userDTO.username) &&
                java.util.Objects.equals(password, userDTO.password) &&
                java.util.Objects.equals(email, userDTO.email);
    }

    // hashCode 方法
    @Override
    public int hashCode() {
        return java.util.Objects.hash(username, password, email);
    }

    // toString 方法
    @Override
    public String toString() {
        return "UserDTO{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}